package com.cnr.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "posts", catalog = "test")
public class Posts implements java.io.Serializable {

	private static final long serialVersionUID = 5319831242675233299L;
	private Long id;
	private Credentials credentials;
	private String link;
	private Integer likes;
	private Integer shares;
	private String via;

	public Posts() {
	}

	public Posts(Credentials credentials, String link) {
		this.credentials = credentials;
		this.link = link;
	}

	public Posts(Credentials credentials, String link, Integer likes,
			Integer shares, String via) {
		this.credentials = credentials;
		this.link = link;
		this.likes = likes;
		this.shares = shares;
		this.via = via;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId", nullable = false)
	public Credentials getCredentials() {
		return this.credentials;
	}

	public void setCredentials(Credentials credentials) {
		this.credentials = credentials;
	}

	@Column(name = "link", nullable = false, length = 250)
	public String getLink() {
		return this.link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	@Column(name = "likes")
	public Integer getLikes() {
		return this.likes;
	}

	public void setLikes(Integer likes) {
		this.likes = likes;
	}

	@Column(name = "shares")
	public Integer getShares() {
		return this.shares;
	}

	public void setShares(Integer shares) {
		this.shares = shares;
	}

	@Column(name = "via", length = 9)
	public String getVia() {
		return this.via;
	}

	public void setVia(String via) {
		this.via = via;
	}

}
